<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017年02月22日14:13:03
 * Time: 10:36
 * APP用户信息model
 */
namespace Common\Model;
use Common\Model\CommonModel;
class AppUsersModel extends CommonModel{

    /**
     * 由商户ID获取商户下面的用户ID
     * @param $shop_id 商户ID
     * @return mixed
     */
    function get_user_id_from_shop_id($shop_id){
        return $this->where(array('is_shop'=>$shop_id))->field('user_id')->find();
    }

    /**
     * 由商户ID获取商户下面的用户ID
     * @param $shop_id 商户ID
     * @return mixed
     */
    function get_user_id_from_shop_ids($shop_id){
        $ret =  $this->where(array('is_shop'=>$shop_id))->field('user_id')->select();
        foreach ($ret as $v)
        {
            $v = join(",",$v); //可以用implode将一维数组转换为用逗号连接的字符串
            $temp[] = $v;
        }
        $t="";
        foreach($temp as $v){
            $t.="".$v."".",";
        }
        $t=substr($t,0,-1);
        return $t;
    }
}